import Component, { mixins } from 'vue-class-component'
import { tableMixins } from '@/mixins'

@Component
export default class extends mixins(tableMixins) {
  // ++++++++++ model ++++++++++
  // ++++++++++ props ++++++++++
  queryPage = this.$Api.user.list
  handleFunc = this.$Api.user

  // ++++++++++ data ++++++++++
  get columns(): Array<IColumn> {
    return [
      { key: 'username', label: '用户名' },
      { key: 'mobile', label: '电话', isShowForm: false },
      { key: 'password', label: '密码', isShowForm: false, isShowTable: false, default: '123456' },
      { key: 'email', label: '邮箱', isShowForm: false },
      {
        key: 'type', label: '用户类型', format: ({ type }) => {
          if (type == 'admin') {
            return '管理员'
          } else if (type == 'doctor') {
            return '医生'
          } else if (type == 'user') {
            return '用户'
          }
        },
      },
    ]
  }

  // ++++++++++ computed ++++++++++
  // ++++++++++ methods normal ++++++++++
  // ++++++++++ methods event ++++++++++
  // ++++++++++ Lifecycle Hooks ++++++++++
  // ++++++++++ watch ++++++++++
}
